package org.jground.rx.ui.zk.viewControl;

import org.jground.rx.RXView;
import org.jground.rx.ui.IUIAttributeView;
import org.jground.rx.ui.zk.UIFrame;
import org.jground.util.ArrayUtils;
import org.zkoss.zk.ui.Component;
import org.zkoss.zul.Html;

public class UIAttributeViewHtmltext extends UIAttributeViewBase {

    public IUIAttributeView<Component,UIFrame> createNew(UIFrame uiFrame, RXView moControl) {
        return new UIAttributeViewHtmltext(uiFrame, moControl);
    }

    public UIAttributeViewHtmltext() {}

    private Html htmlText;

    private UIAttributeViewHtmltext(UIFrame uiFrame, RXView moView) {
        super(uiFrame, moView);
        add(htmlText = new Html());
    }

    public void set(String... values) {
        clear();
        if (ArrayUtils.isNotEmpty(values)) {
            String v = values[0];
            htmlText.setContent(v);
            renderToStringS.add(v);
        }
    }

    public void clear() {
        htmlText.setContent("");
        renderToStringS.clear();
    }

}